#ifndef _DATASOURCE_WRAP_H_
#define _DATASOURCE_WRAP_H_

#include "WrapDefs.h"
#include "Element/OgdcFieldInfo.h"

#ifdef __cplusplus  
extern "C" { 
#endif

RWRAP_API void* RWRAP_CALL Datasource_wrap_open(const char* server, const char* database, 
												   const char* driver, const char* alias, 
												   const char* user, const char* password,
												   const char* type);
RWRAP_API void* RWRAP_CALL Datasource_wrap_create(const char* server, const char* database, 
												const char* driver, const char* alias, 
												const char* user, const char* password,
												const char* type);

RWRAP_API void RWRAP_CALL Datasource_wrap_close(void* pDatasource);

RWRAP_API UGbool RWRAP_CALL Datasource_wrap_del_dataset(void* pDatasource, const char* name);

RWRAP_API UGbool RWRAP_CALL Datasource_wrap_datasets(void* pDatasource, UGlong*);

RWRAP_API void* RWRAP_CALL Datasource_wrap_dataset(void* pDatasource, const char* name);

RWRAP_API UGbool RWRAP_CALL Dataset_wrap_is_vector(void* pDataset);

RWRAP_API UGbool RWRAP_CALL Dataset_wrap_is_raster(void* pDataset);

RWRAP_API UGint RWRAP_CALL Datasource_wrap_count(void* pDatasource);

RWRAP_API char* RWRAP_CALL Dataset_wrap_name(void* pDataset);

RWRAP_API char* RWRAP_CALL Dataset_wrap_type(void* pDataset);

RWRAP_API void RWRAP_CALL Datasource_wrap_delete(void*);

RWRAP_API UGbool RWRAP_CALL DatasetVector_wrap_query_ids(void*, UGint* ids, UGint nCount,  const char* pIDField,
														 Wrap_Records& resultRecords, bool bHasGeometry);

RWRAP_API UGbool RWRAP_CALL DatasetVector_wrap_query(void*, const char* filter, const char* groupBy, 
														const char* orderBy, char const**fields, int fieldCount, 
														bool bHasGeometry, Wrap_Records& resultGeos);

RWRAP_API UGbool RWRAP_CALL DatasetVector_wrap_query_bounds(void*, UGdouble bounds[], const char* filter, 
													 const char* orderBy, Wrap_Records& resultGeos);

RWRAP_API UGbool RWRAP_CALL DatasetVector_wrap_query_geometry(void*, UGGeometry* pGeo, const char* filter, 
													 const char* orderBy, const char* mode, Wrap_Records& resultGeos);

RWRAP_API UGbool RWRAP_CALL Dataset_wrap_open(void* pDataset);

RWRAP_API UGbool RWRAP_CALL Dataset_wrap_getBounds(void* pDataset, UGdouble[]);

RWRAP_API UGbool RWRAP_CALL DatasetVector_wrap_getFieldInfos(void* pDataset, Wrap_FieldInfos& fieldInfos);

RWRAP_API UGbool RWRAP_CALL DatasetVector_wrap_createFields(void* pDataset, Wrap_FieldInfos& fieldInfos);

RWRAP_API UGint RWRAP_CALL ToSpatialQueryMode(const char* mode);

RWRAP_API char* RWRAP_CALL GetFieldTypeName(OgdcFieldInfo::FieldType fieldType);

RWRAP_API UGint RWRAP_CALL Name2FieldType(const char* name);

RWRAP_API char* RWRAP_CALL GetDatasetTypeName(UGint datasetType);

RWRAP_API UGint RWRAP_CALL Name2DatasetType(const char* typeName);

RWRAP_API char* RWRAP_CALL Datasource_wrap_valid_dt_Name(void*,  const char* name);

RWRAP_API void* RWRAP_CALL Datasource_wrap_create_dtv(void*, const char* name, const char* dtType,  Wrap_FieldInfos& fieldInfos);

RWRAP_API char* RWRAP_CALL Datasource_wrap_alias(void*);

RWRAP_API void* RWRAP_CALL DatasetVector_wrap_write(void*, const char* dtName, const char* dtType, 
													Wrap_Geometrys& wrapGeo, char** fieldNames, int fieldCount, 
													char*** fieldValues);

RWRAP_API UGbool RWRAP_CALL DatasetVector_wrap_append(void*, Wrap_Geometrys& wrapGeo, char** fieldNames, int fieldCount, 
													char*** fieldValues);

RWRAP_API UGbool RWRAP_CALL DatasetRaster_wrap_read_pixels(void*, Wrap_Pixels& pixels);

RWRAP_API UGbool RWRAP_CALL DatasetRaster_wrap_read_rasterInfo(void*, Wrap_RasterInfo& rasterInfo);

RWRAP_API void* RWRAP_CALL Datasource_wrap_create_dt_grid(void*,const char* dtName, double bounds[], int width, int height, double dNoValue, const char* pixFormat);

RWRAP_API void* RWRAP_CALL  DatasetRaster_wrap_writer_pixelDataFrame(void* pDatasource, const char* dtName, double bounds[], int width, int height,
														     const char* pixFormat, int* pGridIndex, double* pPixel, int gridIndexCount);

RWRAP_API int RWRAP_CALL Name2PixelFormat(const char* pixFormat);

RWRAP_API char* RWRAP_CALL PixelFormat2Name(int pixFormat);

#ifdef __cplusplus
}
#endif


#endif